#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
#include<math.h>
int reverse(int x) {
    if (x == 0 || x == INT_MIN)
        return 0;
    int a = x < 0 ? -x : x;
    int mem = 0;
    long long res = 0;
    while (a /= 10)
    {
        mem++;
    }
    int b = x < 0 ? -x : x;
    while (b)
    {
        res += (b % 10) * pow(10, mem);
        mem--;
        b = b / 10;
    }
    res = x < 0 ? -res : res;
    if (res > INT_MAX || res < INT_MIN)
        return 0;
    return res;
}
int main()
{
    int x = 132423;
    int a=reverse(x);
    cout << a << endl;
    return 0;
}